package com.niiwoo.civet.account.enums;/**
 * Created by DELL on 2017/12/13.
 */

import com.niiwoo.tripod.provider.exception.NoSuchEnumValueException;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 订单类型枚举
 *
 * @author xiaoyingping
 * @create 2017-12-13 21:48
 **/
@AllArgsConstructor
@Getter
public enum OrderTypeEnum {

    NONE((byte) 0, "无", BillBusinessTypeEnum.OTHER),
    RECHARGE((byte) 1, "充值", BillBusinessTypeEnum.RECHARGE),
    WITHDRAW((byte) 2, "提现", BillBusinessTypeEnum.WITHDRAW),
    INVEST((byte) 3, "投资", BillBusinessTypeEnum.INVEST),
    LEND((byte) 4, "放款", BillBusinessTypeEnum.LEND),
    FUND_TRANSFER((byte) 5, "资金划拨", BillBusinessTypeEnum.OTHER),
    ACTIVITY((byte) 9, "活动", BillBusinessTypeEnum.PRIZED),
    REPAYMENT((byte)10,"还款", BillBusinessTypeEnum.REPAYMENT),
    RECHARGE_AUTO((byte) 11, "自动充值(代扣)", BillBusinessTypeEnum.RECHARGE),
    GUARANTEE((byte) 12, "垫付", BillBusinessTypeEnum.REPAYMENT),//机构代偿也使用这个
    RECEIVED_REPAYMENT((byte) 13, "回款", BillBusinessTypeEnum.RECEIVED_REPAYMENT),
    FUNDS_FREEZE((byte)14,"机构资金冻结", BillBusinessTypeEnum.OTHER),
    CREDITOR_TRANSFER((byte)15,"债权转让", BillBusinessTypeEnum.CREDITOR_TRANSFER),
    ZNT_INVEST((byte)16,"智能投投资", BillBusinessTypeEnum.INVEST),
    USER_RED((byte)17,"用户红包", BillBusinessTypeEnum.OTHER),



    ADJUST_ACCOUNT((byte)99,"错账调整", BillBusinessTypeEnum.OTHER),
    ;

    public static OrderTypeEnum enumOf(Byte code){
        for (OrderTypeEnum orderTypeEnum : values()) {
            if (orderTypeEnum.code.equals(code)) {
                return orderTypeEnum;
            }
        }
        throw new NoSuchEnumValueException("OrderTypeEnum:"+code);
    }

    private Byte code;
    private String desc;
    private BillBusinessTypeEnum billBusinessTypeEnum;//BillBusinessTypeEnum中的code

}
